<template>
  <div class="glzhisfl">
    <h7>事业领导职数</h7>
    <ul class="governzhis">
      <li>
        <p>领导职数核定</p>
        <p @click="sybzLdzs()">{{ ldzshd }}</p>
      </li>
      <li>
        <p>领导职数实配</p>
        <p @click="syzzLdzs()">{{ ldzssp }}</p>
      </li>
    </ul>
  </div>
  <el-dialog
  :draggable="true"
    :title="ldzsTitle"
    v-model="dialogVisible"
    width="50%"
    destroy-on-close
  >
    <!-- <div class="mg-chart" ref="mgcharts"></div> -->
    <SyjgLdzsChild
	@updateTitle="updateTitle"
      :depCode="depCode"
      :ldzstype="ldzstype"
    ></SyjgLdzsChild>
  </el-dialog>
</template>

<script>
import Sever from "@/api/selfApi";
import SyjgLdzsChild from "@/components/home/SyjgLdzsChild";
export default {
  name: "HomeRightSydwLdzs",
  data() {
    return {
      ldzshd: 0,
      ldzssp: 0,
	  depCode:"36%",
	  ldzstype:"",
	  ldzsTitle: "",
	  dialogVisible: false,
    };
  },
  mounted() {
    this.refreshData("36%");
  },
  computed: {
    changeData() {
      return this.$store.state.depCode;
    },
  },
  watch: {
    changeData: {
      handler(newV) {
        this.refreshData(newV);
      },
    },
  },
  components:{
  	  Sever,
  	  SyjgLdzsChild
  },
  methods: {
    async refreshData(depCode) {
      await Sever.smz
        .getSyldzs({ depCode: depCode })
        .then((res) => {
          if (res.code == 1) {
            this.ldzshd = res.data.ldbz;
            this.ldzssp = res.data.ldzz;
            this.showLoading = false;
          } else {
            console.log("bzqk请求错误！");
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
	sybzLdzs() {
		this.ldzstype="bz";
		this.ldzsTitle="事业领导职数核定详情"
	  this.dialogVisible = true;
	},
	
	
	syzzLdzs() {
		this.ldzstype="zz";
		this.ldzsTitle="事业领导职数实配详情"
	  this.dialogVisible = true;
	},
	
	updateTitle(val){
		this.ldzsTitle=val+"详情";
		
	}
  },
};
</script>